 <template>
  <div>
    <ul class="nav">
      <li v-for="i in data" @click="xs($event)" :key="i" :index="i._id">
        {{ i.title }}
        <img :src="i.pic" alt="" />
      </li>
    </ul>
    <router-link
      :to="'Xq?id=' + s._id"
      tag="div"
      v-for="s in arrnew"
      :key="s.pic"
      :index="s.id"
      class="im"
    >
      <img :src="fz(s.pic)" alt="" />
      <p>{{ s.title }}</p>
    </router-link>
  </div>
</template>
 <script>
  import Bus from "@/bus.js"
export default {
  props: {
    data: {
      type: Array,
      default: "data",
    },
  },
  data() {
    return {
      arrnew: [],
      uer:"456"
    };
  },
  methods: {
    xs(e) {
      this.index = e.target.getAttribute("index");
      this.axios
        .get("https://jd.itying.com/api/plist?cid=" + this.index)
        .then((res) => {
          this.xq = res.data.result;
          this.xq.forEach((item) => {
            this.id = item._id;
            this.arrnew = this.xq;
          });
        });
        Bus.$emit("val",this.uer)
    },
    fz(str) {
      return "http://jd.itying.com/" + str.split("\\").join("/");
    },
  },
  computed: {},
};
</script>
 <style lang='css'>
</style>